home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!bbn.com!rsalz
- From: rsalz@uunet.uu.net (Rich Salz)
- Newsgroups: comp.sources.unix
- Subject: v18i073: MIT Athena delete/undelete programs, Part01/06
- Message-ID: <1633@fig.bbn.com>
- Date: 29 Mar 89 04:30:51 GMT
- Lines: 876
- Approved: rsalz@uunet.UU.NET
-
- Submitted-by: Jonathan I. Kamens <jik@PIT-MANAGER.MIT.EDU>
- Posting-number: Volume 18, Issue 73
- Archive-name: undel/part01
-
- [ This will need a bit of work to run under non-BSD. It's also
- probably going to be the LAST safe-rm/unrm/whatever posting
- I approve, except for patches. --r$ ]
-
- This archives contains the sources for five programs (well, actually,
- four, since one is a symbolic link):
- delete
- undelete
- expunge
- purge
- lsdel
-
- The programs were written at Project Athena in response to the problem
- which many novice Unix users have with accidentally deleting files
- they didn't want to delete (Hell, I've done it :-).
-
- I am already aware of quite a few improvements I could make in the
- code (I am fairly certain that there are better regexp matching
- libraries *and* better directory searching libraries I could be
- using.), and I will be making them as soon as I am done with my
- current project. I would appreciate hearing any suggestions you may
- have and/or accepting any patches you wish to submit :-)
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 6)."
- # Contents: MANIFEST README col.h delete.h directories.h expunge.h
- # lsdel.h man1 man1/expunge.1 man1/lsdel.1 man1/purge.1
- # man1/undelete.1 mit-copyright.h pattern.h undelete.h util.h
- # Wrapped by jik@pit-manager on Mon Mar 27 12:16:44 1989
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFEST'\"
- else
- echo shar: Extracting \"'MANIFEST'\" \(920 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X MANIFEST 1 This shipping list
- X Makefile 2
- X README 1
- X col.c 2
- X col.h 1
- X delete.c 3
- X delete.h 1
- X directories.c 6
- X directories.h 1
- X expunge.c 4
- X expunge.h 1
- X lsdel.c 3
- X lsdel.h 1
- X man1 1
- X man1/delete.1 2
- X man1/expunge.1 1
- X man1/lsdel.1 1
- X man1/purge.1 1
- X man1/undelete.1 1
- X mit-copyright.h 1
- X pattern.c 4
- X pattern.h 1
- X undelete.c 5
- X undelete.h 1
- X util.c 2
- X util.h 1
- END_OF_FILE
- if test 920 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- fi
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(1463 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XThis archives contains the sources for five programs (well, actually,
- Xfour, since one is a symbolic link):
- X
- X delete
- X undelete
- X expunge
- X purge
- X lsdel
- X
- XThe programs were written at Project Athena in response to the problem
- Xwhich many novice Unix users have with accidentally deleting files
- Xthey didn't want to delete (Hell, I've done it :-).
- X
- XI am already aware of quite a few improvements I could make in the
- Xcode (I am fairly certain that there are better regexp matching
- Xlibraries *and* better directory searching libraries I could be
- Xusing.), and I will be making them as soon as I am done with my
- Xcurrent project. I would appreciate hearing any suggestions you may
- Xhave and/or accepting any patches you wish to submit :-)
- X
- XI've only compiled these under 4.3BSD on VAXen and IBM RT/PC's, as
- Xwell as on Mach on the NeXT Machine, but I assume they should compile
- Xwith minimal trouble on other architectures (does SysV have the
- Xre_comp and re_exec procedures for regular expression matching?).
- X
- XIf you make it compile on another platform and you have to make
- Xchanges, please send me patches.
- X
- XMy address:
- X
- XJonathan Kamens USnail:
- XMIT Project Athena 410 Memorial Drive, No. 223F
- Xjik@Athena.MIT.EDU Cambridge, MA 02139-4318
- XOffice: 617-253-4261 Home: 617-225-8218
- X
- XP.S. Please see the file "mit-copyright.h" for copying and
- Xredistribution information. Copyright 1989 Massachusetts Institute of
- XTechnology. All Rights Reserved. Etc.
- END_OF_FILE
- if test 1463 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'col.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'col.h'\"
- else
- echo shar: Extracting \"'col.h'\" \(1485 characters\)
- sed "s/^X//" >'col.h' <<'END_OF_FILE'
- X/*
- X * $Source: /mit/jik/src/delete/RCS/col.h,v $
- X * $Author: jik $
- X *
- X * This header file is part of a package including delete, undelete,
- X * lsdel, expunge and purge. The software suite is meant as a
- X * replacement for rm which allows for file recovery.
- X *
- X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- X * For copying and distribution information, see the file "mit-copyright.h."
- X */
- X#include "mit-copyright.h"
- X
- X/*
- X * DEF_COL_WIDTH: the column with to try to use if none is specified.
- X * DEF_WAIT: 1 if the program is supposed to wait for stdin to get to
- X * end-of-file and then print out everything in order in
- X * columns by default. If this is 0, then the default is
- X * for the program to print across instead of down and to
- X * print as it receives input from stdin.
- X * DEF_VAR_COLS: if 1, use variable-width columns based on text width.
- X * if 1, DEF_WAIT must be true.
- X * DEF_SCR_WIDTH: default screen width
- X * DEF_NUM_ITEMS: if 1, number each item
- X * DEF_MARGIN: the default margin in between columns of text
- X */
- X#define DEF_COL_WIDTH 20
- X#define DEF_WAIT 1
- X#define DEF_VAR_COLS 1
- X#define DEF_SCR_WIDTH 80
- X#define DEF_NUM_ITEMS 1
- X#define DEF_MARGIN 2
- X /* This is used for when we need a guess as to how long a number will */
- X /* be when printed. Also, if we are supposed to work in wait mode */
- X /* and are not given a maxitems value, this is what is used. */
- X#define DEF_MAX_ITEMS 10000
- END_OF_FILE
- if test 1485 -ne `wc -c <'col.h'`; then
- echo shar: \"'col.h'\" unpacked with wrong size!
- fi
- # end of 'col.h'
- fi
- if test -f 'delete.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'delete.h'\"
- else
- echo shar: Extracting \"'delete.h'\" \(536 characters\)
- sed "s/^X//" >'delete.h' <<'END_OF_FILE'
- X/*
- X * $Source: /mit/jik/src/delete/RCS/delete.h,v $
- X * $Author: jik $
- X * $Header: delete.h,v 1.3 89/03/27 12:06:11 jik Exp $
- X *
- X * This file is part of a package including delete, undelete,
- X * lsdel, expunge and purge. The software suite is meant as a
- X * replacement for rm which allows for file recovery.
- X *
- X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- X * For copying and distribution information, see the file "mit-copyright.h."
- X */
- X
- X#define ERROR_MASK 1
- X#define NO_DELETE_MASK 2
- X
- X#include "mit-copyright.h"
- END_OF_FILE
- if test 536 -ne `wc -c <'delete.h'`; then
- echo shar: \"'delete.h'\" unpacked with wrong size!
- fi
- # end of 'delete.h'
- fi
- if test -f 'directories.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'directories.h'\"
- else
- echo shar: Extracting \"'directories.h'\" \(1434 characters\)
- sed "s/^X//" >'directories.h' <<'END_OF_FILE'
- X/*
- X * $Source: /mit/jik/src/delete/RCS/directories.h,v $
- X * $Author: jik $
- X * $Header: directories.h,v 1.6 89/03/27 12:06:24 jik Exp $
- X *
- X * This file is part of a package including delete, undelete,
- X * lsdel, expunge and purge. The software suite is meant as a
- X * replacement for rm which allows for file recovery.
- X *
- X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- X * For copying and distribution information, see the file "mit-copyright.h."
- X */
- X
- X#include "mit-copyright.h"
- X
- Xtypedef short Boolean;
- X#define True (Boolean) 1
- X#define False (Boolean) 0
- X
- X
- X#define blk_to_k(x) (x * DEV_BSIZE / 1024)
- X
- X#define FOLLOW_LINKS 1
- X#define DONT_FOLLOW_LINKS 0
- X
- Xtypedef struct filrec {
- X char name[MAXNAMLEN];
- X struct filrec *previous;
- X struct filrec *parent;
- X struct filrec *dirs;
- X struct filrec *files;
- X struct filrec *next;
- X Boolean specified;
- X Boolean freed;
- X struct stat specs;
- X} filerec;
- X
- X
- X
- Xfilerec *add_directory_to_parent();
- Xfilerec *add_file_to_parent();
- Xfilerec *add_path_to_tree();
- Xfilerec *find_child();
- Xfilerec *first_in_directory();
- Xfilerec *first_specified_in_directory();
- Xfilerec *get_cwd_tree();
- Xfilerec *get_root_tree();
- Xfilerec *next_directory();
- Xfilerec *next_in_directory();
- Xfilerec *next_leaf();
- Xfilerec *next_specified_directory();
- Xfilerec *next_specified_in_directory();
- Xfilerec *next_specified_leaf();
- X
- Xchar *get_leaf_path();
- Xchar **accumulate_names();
- END_OF_FILE
- if test 1434 -ne `wc -c <'directories.h'`; then
- echo shar: \"'directories.h'\" unpacked with wrong size!
- fi
- # end of 'directories.h'
- fi
- if test -f 'expunge.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'expunge.h'\"
- else
- echo shar: Extracting \"'expunge.h'\" \(591 characters\)
- sed "s/^X//" >'expunge.h' <<'END_OF_FILE'
- X/*
- X * $Source: /mit/jik/src/delete/RCS/expunge.h,v $
- X * $Author: jik $
- X * $Header: expunge.h,v 1.3 89/03/27 12:06:56 jik Exp $
- X *
- X * This file is part of a package including delete, undelete,
- X * lsdel, expunge and purge. The software suite is meant as a
- X * replacement for rm which allows for file recovery.
- X *
- X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- X * For copying and distribution information, see the file "mit-copyright.h."
- X */
- X#include "mit-copyright.h"
- X
- X#define ERROR_MASK 1
- X#define NO_DELETE_MASK 2
- X#define NO_TIMEOUT_MASK 4
- X
- Xchar **get_the_files();
- END_OF_FILE
- if test 591 -ne `wc -c <'expunge.h'`; then
- echo shar: \"'expunge.h'\" unpacked with wrong size!
- fi
- # end of 'expunge.h'
- fi
- if test -f 'lsdel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lsdel.h'\"
- else
- echo shar: Extracting \"'lsdel.h'\" \(558 characters\)
- sed "s/^X//" >'lsdel.h' <<'END_OF_FILE'
- X/*
- X * $Source: /mit/jik/src/delete/RCS/lsdel.h,v $
- X * $Author: jik $
- X * $Header: lsdel.h,v 1.3 89/03/27 12:07:23 jik Exp $
- X *
- X * This file is part of a package including delete, undelete,
- X * lsdel, expunge and purge. The software suite is meant as a
- X * replacement for rm which allows for file recovery.
- X *
- X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- X * For copying and distribution information, see the file "mit-copyright.h."
- X */
- X#include "mit-copyright.h"
- X
- X#define ERROR_MASK 1
- X#define NO_DELETE_MASK 2
- X
- Xchar **get_the_files();
- END_OF_FILE
- if test 558 -ne `wc -c <'lsdel.h'`; then
- echo shar: \"'lsdel.h'\" unpacked with wrong size!
- fi
- # end of 'lsdel.h'
- fi
- if test ! -d 'man1' ; then
- echo shar: Creating directory \"'man1'\"
- mkdir 'man1'
- fi
- if test -f 'man1/expunge.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man1/expunge.1'\"
- else
- echo shar: Extracting \"'man1/expunge.1'\" \(3824 characters\)
- sed "s/^X//" >'man1/expunge.1' <<'END_OF_FILE'
- X.\" $Source: /mit/jik/src/delete/man1/RCS/expunge.1,v $
- X.\" $Author: jik $
- X.\" $Header: expunge.1,v 1.4 89/03/27 11:32:49 jik Exp $
- X.\"
- X.\" Copyright 1989 by the Massachusetts Institute of Technology. All
- X.\" rights reserved. The file /usr/include/mit-copyright.h specifies
- X.\" the terms and conditions for redistribution.
- X.\"
- X.\"
- X.TH EXPUNGE 1 "January 27, 1988" "MIT Project Athena"
- X.ds ]W MIT Project Athena
- X.SH NAME
- Xexpunge, purge \- permanent removal of \fIdelete\fR\^d files
- X.SH SYNOPSIS
- X.B expunge
- X[
- X.B \-r
- X] [
- X.B \-i
- X] [
- X.B \-f
- X] [
- X.B \-t \fIn\fR
- X] [
- X.B \-n
- X] [
- X.B \-v
- X] [
- X.B \-l
- X] [
- X.B \-y
- X] [
- X.B \-\|\-
- X] [ filename [ ... ]]
- X.PP
- X.B purge
- X.PP
- X.SH DESCRIPTION
- X.I Expunge
- Xand
- X.I purge
- Xpermanently remove files which have been marked for deletion using
- X\fIdelete\fR(1). Files removed with \fIexpunge\fR or \fIpurge\fR
- Xcannot be recovered, and care should therefore be exercised in the
- Xuse of these utilities.
- X.PP
- X.I Purge
- Xis a simple utility which takes no command-line arguments. When it is
- Xexecuted, it searches through the user's entire home directory and
- Xfinds all files that have been marked for deletion. It then displays
- Xa list of the files where are to be removed and prompts for
- Xconfirmation. A response from the user starting with the letter
- X\fIy\fR will cause the files to be permanently expunged.
- X.PP
- XBecause
- X.I purge
- Xsearches through the user's entire home directory, it can take quite a
- Xwhile to complete its search. This is normal.
- X.PP
- XThe filenames passed to
- X.I expunge
- Xon the command-line can be directories (deleted or not deleted) or
- Xdeleted files. Deleted files or directories are always completely
- Xexpunged, while the treatment of non-deleted directories depends on
- Xthe
- X.BR \-r
- Xcommand-line option (see below). If no command-line filenames are
- Xspecified,
- X.I expunge
- Xdefaults to the current working directory.
- X.PP
- XFor information about wildcard use with \fIexpunge\fR, please see
- X\fIundelete\fR(1).
- X.PP
- X.SH OPTIONS
- X.I Expunge
- Xaccepts the following command-line options:
- X.TP
- X.B \-r
- XWhen a non-deleted directory is passed to \fIexpunge\fR, the
- X.BR \-r
- Xoption causes the directory to be searced recursively for deleted
- Xfiles. If the recursive option is \fInot\fR specified, only the
- Xdirect children of the non-deleted directory are examined. A
- Xrecursive search of a large directory can take quite a while.
- X.TP
- X.B \-i
- XThe user is prompted for confirmation with the name of the file and
- Xits size in kilobytes before each file or directory is
- Xrestored.
- X.TP
- X.B \-f
- XUsed in conjunction with the
- X.BR \-l
- Xoption, this option prevents
- X.I expunge
- Xfrom prompting for confirmation after listing all the files that are
- Xtoo be deleted. Furthermore, it prevents the printing of error
- Xmessages.
- X.TP
- X.B \-t\fIn\fR
- XSpecifies the minimum age (in days) of files to be expunged, measured
- Xas the length of time since the last file modification.
- X.TP
- X.B \-n
- XNo file expunges are performed. Instead,
- X.I expunge
- Xprints to the standard output the files that it would expunge were the
- X.BR \-n
- Xoption not specified.
- X.TP
- X.B \-v
- XCauses
- X.I expunge
- Xto report each file as it is expunged, as well as the size of the file
- Xand a running total of the number of kilobytes expunged.
- X.TP
- X.B \-l
- XCauses
- X.I expunge
- Xto list all found files before expunging them, similar to the actions
- Xof
- X.I purge.
- X.TP
- X.B \-y
- XThe total number of kilobytes expunged is printed after
- X.I expunge
- Xis finished removing files.
- X.TP
- X.B \-\|\-
- XTwo dashes indicate that all arguments following it are to be treated
- Xas file names, even if they start with a dash.
- X.SH "SEE ALSO"
- Xdelete(1), undelete(1), lsdel(1), rm(1), rmdir(1)
- X.SH AUTHOR
- XJonathan I. Kamens (MIT-Project Athena)
- X.SH RESTRICTIONS
- XCopyright (c) 1989 by the Massachusetts Institute of Technology. All
- Xrights reserved.
- X.IR Delete (1)
- Xspecifies the terms and conditions for redistribution.
- END_OF_FILE
- if test 3824 -ne `wc -c <'man1/expunge.1'`; then
- echo shar: \"'man1/expunge.1'\" unpacked with wrong size!
- fi
- # end of 'man1/expunge.1'
- fi
- if test -f 'man1/lsdel.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man1/lsdel.1'\"
- else
- echo shar: Extracting \"'man1/lsdel.1'\" \(1902 characters\)
- sed "s/^X//" >'man1/lsdel.1' <<'END_OF_FILE'
- X.\" $Source: /mit/jik/src/delete/man1/RCS/lsdel.1,v $
- X.\" $Author: jik $
- X.\" $Header: lsdel.1,v 1.3 89/03/27 11:32:45 jik Exp $
- X.\"
- X.\" Copyright 1989 by the Massachusetts Institute of Technology. All
- X.\" rights reserved. The file /usr/include/mit-copyright.h specifies
- X.\" the terms and conditions for redistribution.
- X.\"
- X.\"
- X.TH LSDEL 1 "January 27, 1988" "MIT Project Athena"
- X.ds ]W MIT Project Athena
- X.SH NAME
- Xlsdel \- list deleted files
- X.SH SYNOPSIS
- X.B lsdel
- X[
- X.B \-d
- X] [
- X.B \-r
- X] [
- X.B \-t \fIn\fR
- X] [
- X.B \-y
- X] [ filename [ ... ]]
- X.PP
- X.SH DESCRIPTION
- X.I Lsdel
- Xlists files that have been marked for deletion by the \fIdelete\fR(1)
- Xprogram.
- X.PP
- XFor information about using wildcards with \fIlsdel\fR, see
- X\fIundelete\fR(1).
- X.PP
- XFilenames passed to \fIlsdel\fR can be directories (non-deleted or
- Xdeleted) or deleted files. If a non-deleted directory is specified,
- Xlsdel lists the deleted contents of that directory. If the
- X.BR \-r
- Xoption is specified, all non-deleted children of the directory will be
- Xsearched recursively for deleted files. If not command-line filenames
- Xare specified,
- X.I lsdel
- Xdefaults to the current working directory.
- X.PP
- X.I Lsdel
- Xrecursively lists deleted directories by default. This can be
- Xdisabled with the
- X.BR \-d
- Xoption, which causes directory names, rather than their contents, to
- Xbe listed.
- X.PP
- XThe
- X.BR \-t
- Xoption allows the user to specify a minimum age, in days, of files to
- Xlist. Only files that have not been modified in \fIn\fR days or more
- Xwill be listed.
- X.PP
- XThe
- X.BR \-y
- Xoption causes
- X.I lsdel
- Xto print the total amount of space taken up by all the files it lists.
- X.SH "SEE ALSO"
- Xdelete(1), undelete(1), purge(1), expunge(1), ls(1)
- X.SH AUTHOR
- XJonathan I. Kamens (MIT-Project Athena)
- X.SH RESTRICTIONS
- XCopyright (c) 1989 by the Massachusetts Institute of Technology. All
- Xrights reserved.
- X.IR Delete (1)
- Xspecifies the terms and conditions for redistribution.
- END_OF_FILE
- if test 1902 -ne `wc -c <'man1/lsdel.1'`; then
- echo shar: \"'man1/lsdel.1'\" unpacked with wrong size!
- fi
- # end of 'man1/lsdel.1'
- fi
- if test -f 'man1/purge.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man1/purge.1'\"
- else
- echo shar: Extracting \"'man1/purge.1'\" \(348 characters\)
- sed "s/^X//" >'man1/purge.1' <<'END_OF_FILE'
- X.\" $Source: /mit/jik/src/delete/man1/RCS/purge.1,v $
- X.\" $Author: jik $
- X.\" $Header: purge.1,v 1.1 89/01/27 04:50:13 jik Exp $
- X.\"
- X.\" Copyright 1989 by the Massachusetts Institute of Technology. All
- X.\" rights reserved. The file /usr/include/mit-copyright.h specifies
- X.\" the terms and conditions for redistribution.
- X.\"
- X.\"
- X.so man1/expunge.1
- END_OF_FILE
- if test 348 -ne `wc -c <'man1/purge.1'`; then
- echo shar: \"'man1/purge.1'\" unpacked with wrong size!
- fi
- # end of 'man1/purge.1'
- fi
- if test -f 'man1/undelete.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man1/undelete.1'\"
- else
- echo shar: Extracting \"'man1/undelete.1'\" \(3506 characters\)
- sed "s/^X//" >'man1/undelete.1' <<'END_OF_FILE'
- X.\" $Source: /mit/jik/src/delete/man1/RCS/undelete.1,v $
- X.\" $Author: jik $
- X.\" $Header: undelete.1,v 1.3 89/03/27 11:32:32 jik Exp $
- X.\" Copyright 1989 by the Massachusetts Institute of Technology. All
- X.\" rights reserved. The file /usr/include/mit-copyright.h specifies
- X.\" the terms and conditions for redistribution.
- X.\"
- X.\"
- X.TH UNDELETE 1 "January 26, 1988" "MIT Project Athena"
- X.ds ]W MIT Project Athena
- X.SH NAME
- Xundelete \- recover files removed by delete
- X.SH SYNOPSIS
- X.B undelete
- X[
- X.B \-r
- X] [
- X.B \-i
- X] [
- X.B \-f
- X] [
- X.B \-v
- X] [
- X.B \-n
- X] [
- X.B \-R
- X] [
- X.B \-\|\-
- X] [ filename [ ... ]]
- X.PP
- X.DESCRIPTION
- X.I Undelete
- Xrecovers files and directories that have been marked for permanent removal by
- X\fIdelete\fR(1), but have not
- Xyet been removed.
- X.PP
- XFilenames passed to
- X.I undelete
- Xcan be directories or deleted files.
- XIf a directory that is not deleted is passed to
- X.I undelete,
- Xthen the deleted files or directories in it will be restored; if the
- Xrecursive option is specified, then all deleted files or directories
- Xin any of its children will be restored as well.
- X.PP
- XThe shell wildcards \fI*\fR and \fI?\fR are interpreted correctly by
- X.I undelete.
- XIt is possible to pass wildcards to the program without the wildcards
- Xbeing intercepted by the shell by setting
- X.I noglob
- X(in \fIcsh\fR) or by quoting the wildcards. To delete a file that
- Xactually has a wildcard in its name, you must precede the quoted
- Xwildcard with a quoted backslash.
- X.PP
- XIf no files are specified on the command line,
- X.I undelete
- Xgoes into interactive mode. In interactive mode, the user is prompted
- Xto enter files to be restored, one file per line. Typing a carriage
- Xreturn on an empty prompt line exits the program.
- X.PP
- XWildcards and quoting backslashes can be entered directly at the
- Xprompt without any shell interference (which is the
- Xmain reason there is an interactive mode).
- X.SH OPTIONS
- X.I Undelete
- Xaccepts the following command-line options:
- X.TP
- X.B \-r
- XIf a specified file is a directory, the directory and all of its
- Xchildren are restored recursively. If a specified file is a symbolic
- Xlink to a directory, then the directory and its contents will be
- Xrestored, not the symbolic link.
- X.TP
- X.B \-i
- XThe user is prompted for confirmation before each file or directory is
- Xrestored. This is not the same as the interactive file name entry
- Xmode which is automatically activated when no files are specified on
- Xthe command line.
- X.TP
- X.B \-f
- XPrevents
- X.I undelete
- Xfrom reporting errors. Further, if an intact (undeleted) version of a
- Xfile which is requested for undeletion exists, then
- X.I undelete
- Xwill not prompt for confirmation before overwriting the undeleted file
- Xwith the recovered one.
- X.TP
- X.B \-v
- XCauses
- X.I undelete
- Xto report each file as it is restored. Also, causes an introductory
- Xmessage to be printed when entering interactive mode.
- X.TP
- X.B \-n
- XNo file recoveries are performed. Instead,
- X.I undelete
- Xprints to the standard output the files that it would recover were the
- X.B \-n
- Xoption not specified.
- X.TP
- X.B \-R
- XPrevents
- X.I undelete
- Xfrom restoring the contents of directories in any case.
- X.TP
- X.B \-\|\-
- XTwo dashes indicate that all arguments following it are to be treated as file
- Xnames, even if they start with a dash.
- X.SH "SEE ALSO"
- Xdelete(1), purge(1), expunge(1), lsdel(1), rm(1), rmdir(1)
- X.SH AUTHOR
- XJonathan I. Kamens (MIT-Project Athena)
- X.SH RESTRICTIONS
- XCopyright (c) 1989 by the Massachusetts Institute of Technology. All
- Xrights reserved.
- X.IR Delete (1)
- Xspecifies the terms and conditions for redistribution.
- END_OF_FILE
- if test 3506 -ne `wc -c <'man1/undelete.1'`; then
- echo shar: \"'man1/undelete.1'\" unpacked with wrong size!
- fi
- # end of 'man1/undelete.1'
- fi
- if test -f 'mit-copyright.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mit-copyright.h'\"
- else
- echo shar: Extracting \"'mit-copyright.h'\" \(1025 characters\)
- sed "s/^X//" >'mit-copyright.h' <<'END_OF_FILE'
- X/*
- X
- XCopyright 1987,1988 by the Massachusetts Institute of Technology
- X
- XAll rights reserved.
- X
- XPermission to use, copy, modify, and distribute this software and its
- Xdocumentation for any purpose and without fee is hereby granted,
- Xprovided that the above copyright notice appear in all copies and that
- Xboth that copyright notice and this permission notice appear in
- Xsupporting documentation, and that the name of the Massachusetts
- XInstitute of Technology (M.I.T.) not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XM.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- XM.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- XSOFTWARE.
- X
- X*/
- END_OF_FILE
- if test 1025 -ne `wc -c <'mit-copyright.h'`; then
- echo shar: \"'mit-copyright.h'\" unpacked with wrong size!
- fi
- # end of 'mit-copyright.h'
- fi
- if test -f 'pattern.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'pattern.h'\"
- else
- echo shar: Extracting \"'pattern.h'\" \(741 characters\)
- sed "s/^X//" >'pattern.h' <<'END_OF_FILE'
- X/*
- X * $Source: /mit/jik/src/delete/RCS/pattern.h,v $
- X * $Author: jik $
- X * $Header: pattern.h,v 1.3 89/03/27 12:07:57 jik Exp $
- X *
- X * This program is part of a package including delete, undelete,
- X * lsdel, expunge and purge. The software suite is meant as a
- X * replacement for rm which allows for file recovery.
- X *
- X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- X * For copying and distribution information, see the file "mit-copyright.h."
- X */
- X#include "mit-copyright.h"
- X
- Xchar **add_str();
- Xchar **find_contents();
- Xchar **find_deleted_contents();
- Xchar **find_deleted_contents_recurs();
- Xchar **find_matches();
- Xchar **find_deleted_matches();
- Xchar **find_recurses();
- Xchar **find_deleted_recurses();
- X
- Xchar *parse_pattern();
- END_OF_FILE
- if test 741 -ne `wc -c <'pattern.h'`; then
- echo shar: \"'pattern.h'\" unpacked with wrong size!
- fi
- # end of 'pattern.h'
- fi
- if test -f 'undelete.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'undelete.h'\"
- else
- echo shar: Extracting \"'undelete.h'\" \(739 characters\)
- sed "s/^X//" >'undelete.h' <<'END_OF_FILE'
- X/*
- X * $Source: /mit/jik/src/delete/RCS/undelete.h,v $
- X * $Author: jik $
- X * $Header: undelete.h,v 1.3 89/03/27 12:08:17 jik Exp $
- X *
- X * This program is part of a package including delete, undelete,
- X * lsdel, expunge and purge. The software suite is meant as a
- X * replacement for rm which allows for file recovery.
- X *
- X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- X * For copying and distribution information, see the file "mit-copyright.h."
- X */
- X#include "mit-copyright.h"
- X
- X#define DELETEPREFIX ".#"
- X#define DELETEREPREFIX "\\.#"
- X#define ERROR_MASK 1
- X#define NO_DELETE_MASK 2
- X
- Xtypedef struct {
- X char *user_name;
- X char *real_name;
- X} listrec;
- X
- Xlistrec *sort_files();
- Xlistrec *unique();
- X
- Xchar **get_the_files();
- END_OF_FILE
- if test 739 -ne `wc -c <'undelete.h'`; then
- echo shar: \"'undelete.h'\" unpacked with wrong size!
- fi
- # end of 'undelete.h'
- fi
- if test -f 'util.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util.h'\"
- else
- echo shar: Extracting \"'util.h'\" \(628 characters\)
- sed "s/^X//" >'util.h' <<'END_OF_FILE'
- X/*
- X * $Source: /mit/jik/src/delete/RCS/util.h,v $
- X * $Author: jik $
- X * $Header: util.h,v 1.4 89/03/27 12:08:41 jik Exp $
- X *
- X * This file is part of a package including delete, undelete,
- X * lsdel, expunge and purge. The software suite is meant as a
- X * replacement for rm which allows for file recovery.
- X *
- X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- X * For copying and distribution information, see the file "mit-copyright.h."
- X */
- X#include "mit-copyright.h"
- X
- Xchar *append();
- Xchar *convert_to_user_name();
- Xchar *firstpart();
- Xchar *lastpart();
- Xchar *reg_firstpart();
- Xchar *strindex();
- Xchar *strrindex();
- END_OF_FILE
- if test 628 -ne `wc -c <'util.h'`; then
- echo shar: \"'util.h'\" unpacked with wrong size!
- fi
- # end of 'util.h'
- fi
- echo shar: End of archive 1 \(of 6\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 6 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 6 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- --
- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
-
-
-